This section describes the routines provided by the Memory Manager. You can use these routines to set up your application's partition, allocate and dispose of relocatable and nonrelocatable blocks, manipulate those blocks, assess the availability of memory in your application's heap, free memory from the heap, and install a grow-zone function for your heap. The Memory Manager also provides routines that allow you to allocate temporary memory and manipulate heap zones.
The result codes listed for Memory Manager routines are usually not directly returned to your application. You need to call the MemError function (or, from assembly language, inspect the MemErr global variable) to get a routine's result code.
You cannot call most Memory Manager routines at interrupt time for several reasons. You cannot allocate memory at interrupt time because the Memory Manager might already be handling a memory-allocation request and the heap might be in an inconsistent state. More generally, you cannot call at interrupt time any Memory Manager routine that returns its result code via the MemError function, even if that routine doesn't allocate or move memory. Resetting the MemErr global variable at interrupt time can lead to unexpected results if the interrupted code depends on the value of MemErr . Note that Memory Manager routines like HLock return their results via MemError and therefore should not be called in interrupt code.